#ifndef _LCD_SPI_H_
#define _LCD_SPI_H_

#include "stdint.h"
#include "pincfg.h" 

#define LCD_SPI      SPI2
#define ISR_IRQn   SPI2_IRQn

//base interface
void lcd_spi_init(void);
void lcd_cs(uint8_t st);
void lcd_spi_high_speed(void);
void lcd_spi_low_speed(void);

//spi data r/w
uint8_t lcd_spi_rb(void);
void lcd_spi_wb(uint8_t dataW);
uint8_t lcd_spi_write(uint8_t *dataw, uint32_t Len);
uint8_t lcd_spi_read(uint8_t *datar, uint32_t Len);

#define lcd_rst_en()     PBout(12)=1
#define lcd_rst_dis()    PBout(12)=0

#define lcd_dc_en()       PBout(0)=1
#define lcd_dc_dis()       PBout(0)=0

#define lcd_light_en()     PAout(4)=1
#define lcd_light_dis()    PAout(4)=0

#endif /* _LCD_SPI_H_ */
